package com.xtm.exercise.feign;

import com.xtm.common.model.SysRole;
import com.xtm.exercise.constant.DemoApiConstant;
import com.xtm.exercise.feign.fallback.UserFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @author hzl
 */
@FeignClient(name = DemoApiConstant.APPLICATION_NAME, fallbackFactory = UserFeignFallbackFactory.class, decode404 = true)
public interface DemoFeign {

    /**
     * 获取用户的角色
     */
    @GetMapping("/users/{id}/roles")
    List<SysRole> findRolesByUserId (@PathVariable(name = "id") Long id);

}
